package com.kevin.design.structuralPattern.bridge;

public class BridgeOfImage {
    public static void main(String[] args) {
        Image image = new WinImage();
        image.setImageImpl(new JPGImageImpl());
        image.prase();
    }
}

interface ImageImpl{
    void doPaint();
}

class JPGImageImpl implements ImageImpl{

    @Override
    public void doPaint() {
        System.out.println("JPG格式");
    }
}

abstract class Image{
    protected  ImageImpl imageImpl;

    public void setImageImpl(ImageImpl imageImpl) {
        this.imageImpl = imageImpl;
    }

    abstract void prase();
}

class WinImage extends Image{

    @Override
    void prase() {
        System.out.println("windows:");
        imageImpl.doPaint();
    }
}
